<template>
  <div id="IntegrityBusiness" class="modelBox">
    <h2 class="title">
      <a href>
        <img src="../../../static/m_img/h_cx.png" alt>
        <span>诚信商家</span>
      </a>
    </h2>
    <Row :gutter="10" class="Row">
      <Col :span="12" class="item" v-for="(item,index) in (BusinessList||'').slice(0,3)" :key="index">
        <a href="javascript:void(0)" @click="enterShop('Shop',item.storeId)">
          <img :src="item.storeHeadImg" alt>
          <p class="ellipsis-1">{{item.storeName}}</p>
          <span>{{item.storePhone}}</span>
        </a>
      </Col>
      <Col :span="12" class="item">
        <a href="javascript:void(0)">
          <!-- <img :src="item.imgSrc" alt> -->
          <p class="ellipsis-1">虚位以待</p>
          <span>欢迎更多商家入驻有个车</span>
        </a>
      </Col>
    </Row>
  </div>
</template>
<script>
import { Row, Col } from "element-ui";
import { getReq } from "../../assets/js/api";
import VueEvent from "../../assets/js/VueEvent.js";
export default {
  data() {
    return {
      city: "",
      district: "",
      BusinessList: [],
      superiorId: ""
    };
  },
  components: { Row, Col },
  methods: {
    getInfo() {
      let params = {
        city: this.city,
        district: this.district
      };
      getReq("/b2c/location/getLocation", params).then(res => {
        let { errcode, message, content } = res;
        if (errcode == 0) {
          this.superiorId = res.content.superiorId;

          this.getList();
        }
      });
    },
    getList() {
      let params = {
        superiorId: this.superiorId
      };
      getReq("/b2c/adver/getIndexAdver", params).then(res => {
        let { errcode, message, content } = res;
        if (errcode == 0) {
          this.BusinessList = content;
        }
      });
    },
    enterShop(name, miniStoreId) {
      this.$router.push({
        name: name,
        query: {
          miniStoreId: miniStoreId
        }
      });
    }
  },
  mounted() {
    VueEvent.$on("to-business", function(data) {
      (this.city = data[0]), (this.district = data[1]);
    });
    this.getInfo();
  }
};
</script>
<style scoped lang='scss'>
#IntegrityBusiness {
  .mu-carousel {
    height: 100px;
  }
  .Row {
    width: 100%;
    margin-top: 12px;
    // display: flex;
    align-items: center;
    justify-content: space-between;
    .item {
      margin-bottom: 10px;
    }
    .item a {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 83.5px;
      box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.12);
      border-radius: 10px;
      img {
        height: 35px;
        width: 35px;
        border: 1px solid rgba(248, 248, 248, 1);
        border-radius: 50%;
      }
      p {
        color: #0098ff;
        font-size: 1.166667rem;
        font-weight: bold;
        margin: 2.5px 0 5px;
        padding: 0 2%;
        width: 100%;
        text-align: center;
        //   line-height: 32px;
        //   height:78px;
      }
      span {
        color: #525252;
        font-size: 1rem;
      }
    }
  }
}
</style>
